#pragma once
#include "Control.h"
#include "Container.h"

class GUI_API CProgress :	public CControl
{
public:
	CProgress(void);
	CProgress(UINT nID);
	CProgress(wstring strCaption,UINT nID);
	CProgress(DWORD dwStyle,wstring strCaption, const CRect &rc, UINT nID);
	CProgress(DWORD dwStyle, wstring strCaption, int x, int y, int cx, int cy, UINT nID);
	virtual ~CProgress(void);

public:

	void GetRange( int &nMin, int &nMax ) { nMin = m_nMin; nMax = m_nMax; };
	int GetRangeMax() { return m_nMax; };
	int GetRangeMin() { return m_nMin; };

	int GetPos() { return m_nPos; };

	void SetRange( int nMin, int nMax, BOOL bRedraw=FALSE );
	void SetRangeMin(int nMin, BOOL bRedraw = FALSE);
	void SetRangeMax( int nMax, BOOL bRedraw = FALSE );

	void SetPos( int nPos );
	int SetPageSize( int nSize );

	BOOL SetBitmapChannel(HBITMAP hChannel, HBITMAP hActive, BOOL bTransparent,COLORREF clrpTransColor);
	BOOL SetBitmapThumb(HBITMAP hThumb, HBITMAP hActive, BOOL bTransparent,COLORREF clrpTransColor);
	void SetMargin( int nLeft, int nTop, int nRight, int nBottom );
	void SetMarginTop( int nMargin ) { m_nMarginTop = nMargin; };
	void SetMarginLeft( int nMargin ) { m_nMarginLeft = nMargin; };
	void SetMarginRight( int nMargin ) { m_nMarginRight = nMargin; };
	void SetMarginBottom( int nMargin ) { m_nMarginBottom = nMargin; };
	void SetVertical( BOOL bVertical=TRUE ) { m_bVertical = bVertical; };
	void DrawFocusRect( BOOL bDraw = TRUE, BOOL bRedraw = FALSE );
	// Generated message map functions

protected:
	virtual int Pixel2Pos( int nPixel );
	virtual int Pos2Pixel( int nPos );

	void Init();
	void DrawBitmap(CDC* pDC, int xStart, int yStart, int wWidth, int wHeight,	CDC* pTmpDC, int xSource, int ySource);

	int m_nMax, m_nMin, m_nPos, m_nPage;
	int m_nWidth, m_nHeight;
	int m_nThumbWidth, m_nThumbHeight;
	int m_nMarginLeft, m_nMarginRight, m_nMarginTop, m_nMarginBottom;
	int m_nMouseOffset;

	BOOL m_bVertical;
	BOOL m_bChannelActive, m_bThumbActive;
	BOOL m_bTransparentChannel, m_bThumb, m_bChannel;
		//zxj here not use
	BOOL m_bLButtonDown, m_bFocus, m_bFocusRect;

	CBitmap m_bmChannel, m_bmChannelActive;
	CBitmap m_bmThumb, m_bmThumbActive;
	COLORREF m_clrTransparent;

public:
		virtual void Paint(CDC* pDC);
		virtual void Click(DWORD dwClick, POINT pt);

};
